home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / start32.zip / EXAMPLE.ASM next >
Assembly Source File  |  1993-04-13  |  2KB  |  90 lines

  1.         .386p
  2. code32  segment para public use32
  3.         assume cs:code32, ds:code32, ss:code32
  4.  
  5. include start32.inc     ; All externs are defined in there
  6.  
  7. public  _main
  8.  
  9. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  10. ; DATA
  11. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  12. msg0            db      'Free low mem:  '
  13. msg0len=$-msg0
  14. msg1            db      'Free high mem: '
  15. msg1len=$-msg1
  16.  
  17. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  18. ; CODE
  19. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  20.  
  21. ;═════════════════════════════════════════════════════════════════════════════
  22. _main:
  23.         @rlp edi,0b8000h                ; fill text screen with stuff
  24.         mov ecx,80*25
  25.         mov al,'▒'
  26.         mov ah,78h
  27.         rep stosw
  28.  
  29.         mov ah,0fh                      ; put amount of free low mem
  30.         @rlp edi,0b8000h+2*160+4
  31.         mov esi,offset msg0
  32.         mov ecx,msg0len
  33. mainl0:
  34.         lodsb
  35.         stosw
  36.         loop mainl0
  37.         call _lomemsize
  38.         call putnum
  39.  
  40.         @rlp edi,0b8000h+3*160+4        ; put amount of free high mem
  41.         mov esi,offset msg1
  42.         mov ecx,msg1len
  43. mainl1:
  44.         lodsb
  45.         stosw
  46.         loop mainl1
  47.         call _himemsize
  48.         call putnum
  49.  
  50. ; Uncomment this and the next piece of code if you have a mouse driver loaded
  51. ; and want to test the handling of real-mode IRQs.
  52. ;       mov v86r_ax,0                   ; Enable and unhide mouse cursor
  53. ;       mov al,33h
  54. ;       int 30h
  55. ;       mov v86r_ax,1
  56. ;       int 30h
  57.  
  58. mainl2:
  59.         mov v86r_ah,0                   ; INT 16h, AH=0, wait for keypress
  60.         mov al,16h
  61.         int 30h
  62.         cmp v86r_al,27                  ; Is it ESC?
  63.         jne mainl2
  64.  
  65. ;       mov v86r_ax,0                   ; Disable mouse
  66. ;       mov al,33h
  67. ;       int 30h
  68.  
  69.         jmp _exit                       ; return to real mode
  70.  
  71. ;-----------------------------------------------------------------------------
  72. putnum:                                 ; put EAX to EDI
  73.         mov edx,eax
  74.         mov ecx,8
  75.         mov ebx,offset _hextbl
  76.         mov ah,0fh
  77. putnuml0:
  78.         rol edx,4
  79.         mov al,dl
  80.         and al,0fh
  81.         xlat
  82.         stosw
  83.         loop putnuml0
  84.         ret
  85.  
  86.  
  87. code32  ends
  88.         end
  89.  
  90.